import api from './index'
function getcardname(array){//判断椒全是什么卡
    var objarray=new Array();
    objarray.push({name:'金卡',number:0,url:api.rooturl+'/static/images/1.png'});
      objarray.push({name:'白卡',number:0,url:api.rooturl+'/static/images/2.png'});
        objarray.push({name:'橙卡',number:0,url:api.rooturl+'/static/images/3.png'});
          objarray.push({name:'黑卡',number:0,url:api.rooturl+'/static/images/4.png'});
            objarray.push({name:'灰卡',number:0,url:api.rooturl+'/static/images/5.png'});
              objarray.push({name:'蓝卡',number:0,url:api.rooturl+'/static/images/6.png'});
                objarray.push({name:'绿卡',number:0,url:api.rooturl+'/static/images/7.png'});
                  objarray.push({name:'银卡',number:0,url:api.rooturl+'/static/images/8.png'});
                    objarray.push({name:'紫卡',number:0,url:api.rooturl+'/static/images/9.png'});
                      objarray.push({name:'棕卡',number:0,url:api.rooturl+'/static/images/10.png'});
                        objarray.push({name:'全部',number:0,url:api.rooturl+'/static/images/11.png'});

  var cardname="";
  var urls="";
  if(Array.isArray(array)) {//说明是个数组
    for(var i=0;i<array.length;i++){
      for (var j = 0; j < objarray.length; j++) {
          if (cardname != array[i].cardName&&cardname!="") {//表示存在两种不同的卡
            return objarray[10].url;
            break;
          }
        if (array[i].cardName == objarray[j].name) {
          objarray[j].number++;
          cardname = array[i].cardName;
          urls = objarray[j].url;
        }
      }

    }
    return urls
  }
  else{
    for (var j = 0; j < objarray.length; j++) {
      if(array.cardName==objarray[j].name){
        return objarray[j].url;
      }
    }
  }
}
export default {
  getcardname: getcardname,
}
